package dfs;

import entity.tree.Node;

public class leetcode559N叉树的最大深度 {
    public int maxDepth(Node root) {
        if (root == null) {
            return 0;
        } else {
            int size = root.children.size();
            int max = 0;
            for (int i = 0; i < size; i++) {
                max = Integer.max(max, maxDepth(root.children.get(i)));
            }
            return max + 1;
        }
    }
}
